home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / smixw130.zip / SMIXW130.DOC < prev    next >
Text File  |  1997-06-06  |  10KB  |  194 lines

  1.           _____      __    __     ____     __   __       _     _
  2.          /  _  \    |  \  /  |   |    |   |  \ /  |     | |   | |
  3.         |  / \__|   |   \/   |    |  |     \  ~  /      | |   | |
  4.         |  \___     |        |    |  |      |   |       | |   | |
  5.          \___  \    |  /\/\  |    |  |      |   |       | | _ | |
  6.          __  \  |   |  |  |  |    |  |      |   |       | |/ \| |
  7.         |  \_/  |   |  |  |  |    |  |     /  ^  \      |   _   |
  8.          \_____/    |__|  |__|   |____|   |__/ \__|     \__/ \__/
  9.  
  10.                   for Watcom C DOS/4GW protected mode
  11.  
  12.                               Version 1.30
  13.                    Written by Ethan Brodsky (97/6/6)
  14.          Copyright 1995 by Ethan Brodsky.  All rights reserved.
  15.  
  16. This library is distributed AS IS.  The author specifically disclaims
  17. responsibility for any loss of profit or any consequential, incidental,
  18. or other damages.  SMIX is freeware and is distributed with full source
  19. code, which is copyright by Ethan Brodsky.  You are free to incorporate
  20. the code in full or part into your own programs as long as credit is
  21. given to Ethan Brodsky.  The source code may be distributed in its
  22. original form only, including this documentation and the copyright
  23. notices.
  24.  
  25. ------------------------------------------------------------------------
  26.  
  27. You may have used my SBVOX and SBDSP units.  They both played one VOC
  28. file at a time.  The whole VOC file had to be loaded into conventional
  29. memory, taking valuable memory from a real mode program.
  30.  
  31. SMIX will play up to 8 sounds at one time.  The sounds are stored
  32. anywhere in memory and mixed into a small buffer as needed.  It should
  33. work with any Sound Blaster compatible sound card.  It uses auto
  34. initialized DMA if it is supported, eliminating clicks between blocks.
  35. If a SB16 is installed, it will use 16-bit sound output, increasing the
  36. sound quality.  Full source for Watcom C protected mode using the
  37. DOS/4GW extender is included.
  38.  
  39. The sounds are stored on disk as raw signed 8-bit sample data at a
  40. sampling rate of 22050 HZ or the sampling rate specified in the SMIX
  41. source file and are loaded anywhere in memory.  The data is mixed into
  42. a 16-bit buffer one block at a time, then copied down to an 8 or 16 bit
  43. buffer in conventional memory for DMA output.
  44.  
  45. In case you are wondering about the three counters displayed by the test
  46. program, the first one counts in the CPU's free time, the second counts
  47. the number of interrupts that have occurred, and the third is the number
  48. of sounds currently being played.  If you have any problems, please tell
  49. me what each counter is doing.
  50.  
  51. You can change the sampling rate used for output by changing the constant
  52. at the top of the SMIX source file.  If you decide to do this, all sound
  53. effects must be sampled at the rate you specify, or they will play at the
  54. wrong frequency.  Higher sampling rates will increase CPU usage.  Do not
  55. use a rate larger than 22050 HZ or SMIX will not work on sound cards
  56. older than the SB16.
  57.  
  58. SMIX either uses a raw 8-bit unsigned file format, or in a combined
  59. resource file.  I have included a program that will convert WAV files to
  60. the raw format necessary, and a program to combine raw sound files into
  61. a resource file.  The WAV files must be 8-bit and sampled at 22050 HZ,
  62. or the output will be distorted.  If you have changed the sampling rate
  63. constant in the SMIX source file then the sounds should be sampled at the
  64. rate you have specified.
  65.  
  66. Use the SNDLIB utility included with this package to build sound resource
  67. files.  The syntax for SNDLIB is similar to that of Borland's TLIB, but
  68. it is much more restrictive.  Remember that resources are identified by
  69. their "key", which comes after the filename when adding a resource.  The
  70. key is an 8 character case-insensitive string that is should be passsed
  71. to the load sound function after you have opened the resource file.
  72.  
  73. The mixing algorithm I use for the SB16 sacrifices volume level for
  74. precision.  This means that the mixed output will be fairly quiet on
  75. 16-bit sounds cards.  However, the SB16 has fairly load output, so it
  76. should come out about right.  If you think that the output is too quiet,
  77. you can disable 16-bit output by passing "0" as the 16-bit DMA channel
  78. to the SB initialization function, ignoring what the detect routine
  79. returns.
  80.  
  81. One important pointer:  The SMIX module MUST be compiled using the "-zu"
  82. compiler switch.  The Watcom code generator erroneously assumes that
  83. SS == DS when generating code for an interrupt handler.  The compiler
  84. then uses EBP to address data in DS and your program will terminate
  85. with a stack fault upon the first sound interrupt.  "-zu" tells the
  86. compiler not to make this assumption and is the best workaround for
  87. this compiler bug.  (Another option is to disable optimizations, but
  88. then the compiler will generate terrible code)  Due to the DOS/4GW
  89. extender used for Watcom C protected mode, sound cards on IRQ10 are
  90. not supported by this version of SMIX.
  91.  
  92. SMIX is not written in C++, but it can be used in a C++ program.
  93. However, you must compile the SMIX, XMS, and DETECT modules as C
  94. code, since they will not compile when treated as C++.  Since the SMIX
  95. modules are compiled as C code, function names are not mangled, and
  96. you must tell your program not to expect mangled names.  To do this,
  97. replace your SMIX includes with this code fragment:
  98.   extern "C"
  99.     {
  100.       #include "smix.h"
  101.       #include "detect.h"
  102.     }
  103.  
  104. I have several improvements planned, but I need feedback.  If you are
  105. using my code, I would greatly appreciate it if you would mail me and
  106. tell me about it.  If you have any bug reports, suggestions, or have
  107. made improvements, please tell me!  I also have available a FM synthesis
  108. MIDI music library and am working on a digital music library, so tell me
  109. what you are interested in!
  110.  
  111. This library is freeware, but I would appreciate contributions so I can
  112. continue to buy development kits and upgrade my computer.  You don't
  113. NEED to send me anything, but if you are making money by using this,
  114. please send whatever you feel it is worth.
  115.  
  116. Features:
  117.   * Up to 8 sounds played simultaneously
  118.   * Sampling rate of 22050 HZ (changable at compile-time)
  119.   * Autoinitialized DMA prevents clicking
  120.   * 16-bit sound output increases quality
  121.   * Mixes in the background using a fraction of CPU time
  122.   * Sound volume control supported
  123.   * Sound resource files allow you to store all sounds in one file
  124.  
  125. ------------------------------------------------------------------------
  126.  
  127. There are several ways to contact me:
  128.     E-Mail:  ebrodsky@pobox.com       (Preferred)
  129.              brodskye@cae.wisc.edu
  130.     WWW:     http://www.pobox.com/~ebrodsky/
  131.              http://www.xraylith.wisc.edu/~ebrodsky/
  132.     Phone:   (608) 238-4830
  133.     Mail:
  134.         Ethan Brodsky
  135.       4010 Cherokee Dr.
  136.       Madison, WI 53711
  137.  
  138. Bug fixes and other announcements will be posted in:
  139.     alt.sb.programmer
  140.     comp.archives.msdos.announce
  141.     comp.sys.ibm.pc.soundcard.tech
  142.     rec.games.programmer
  143.  
  144. Up-to-date versions may be downloaded from:
  145.     http://www.pobox.com/~ebrodsky/smix/smix.html
  146.     ftp.simtel.net /pub/simtelnet/msdos/sound/smix*.zip
  147.     x2ftp.oulu.fi /pub/msdos/programming/mxlibs/smix*.zip
  148.  
  149. Revision history:
  150.  1.11 - Initial release
  151.  1.20 - Switched to a new mixing algorithm that doesn't reduce sound
  152.         volume on 8-bit sound cards.  Added support for sound volume
  153.         control.  Fixed a problem with output on Sound Blaster Pros.
  154.         Optimized mixing code.  Modified code in exit procedure to
  155.         reset sound card on termination.
  156.  1.21 - Modifed shutdown code
  157.  1.22 - Fixed a detection problem with sound cards on DMA0.  Commented
  158.         SMIX interface.  Modified interrrupt acknowledgement.  Added a
  159.         sound_playing function to check if a sound is still playing.
  160.  1.23 - Fixed setup for SB16s that use an 8-bit DMA channel for 16-bit
  161.         sound.  Made all internal functions static.  Added sound_playing
  162.         function to smix.h and copied the interface documentation from
  163.         smix.c to smix.h.
  164.  1.24 - Added support for sound resource files.  New WAV2RAW converter
  165.         that correctly converts all conformant WAV files containing the
  166.         correct type of data.
  167.  1.25 - Fixed a problem in addressing the second half of the DMA memory
  168.         area.  Fixed a problem in addressing the second half of the DMA
  169.         memory area.  Variable sampling rate.  Added library file to
  170.         simplify linking in SMIX.  Added FILE_ID.DIZ for BBS use.
  171.  1.30 - Fixed a bug in the WAV2RAW converter that caused problems with
  172.         non-typical WAV files.  Removed all floating point math to avoid
  173.         linking in unnecessary floating point code and wasting time
  174.         generating volume lookup table.  Fixed a minor bug in the
  175.         initialization routines that prevented SMIX from using
  176.         autoinitialized DMA on sound cards with DSP v2.00.  Prevented
  177.         SMIX from installing its exit handler multiple times.  Improved
  178.         mixtest example program.  Changed load_sound to a function and
  179.         added error handling.  Made start_sound a function, returning
  180.         whether or not it could play the sound.  Switched calls to min()
  181.         and max() to my own MIN() and MAX() to avoid problems if the
  182.         macros are not implemented.  Removed redundant definition of
  183.         handler_installed.  Included a few extra header files to get rid
  184.         of warnings generated when full warnings are turned on.  Added
  185.         instructions on how to use SMIX in a C++ program.  Thanks to
  186.         Ulrich Doewich, Pawel Veselov (a.k.a. Black Angel), Bojan
  187.         Resnik, Christopher Adams, and Robert Rand for their help in
  188.         improving SMIX.
  189.  
  190. I've been looking to get in with a commercial software company.  If any
  191. companies are interested, write to me at the above address.  Thanks!
  192.  
  193.     Ethan Brodsky
  194.